<?php
class DBHelper{
	
	
	function getAll($sql)
	{
		$db = new PDO("mysql:host=localhost;dbname=quanlyxe", "root", "");
		$db->exec("SET CHARACTER SET utf8");  
    	$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
				
		$stmt = $db->prepare($sql);
		$stmt->setFetchMode(PDO::FETCH_ASSOC);
		$stmt->execute();
		$rows = $stmt->fetchAll();
		return $rows;
	}
	
	function insert($sql,$data)
	{
		$statement = $db->prepare($sql);
   		$statement->execute($data); 
	}
	
	function update($sql,$data)
	{
		$statement = $db->prepare($sql);
   		$statement->execute($data); 
	}
	
	function delete($sql,$data)
	{
		$statement = $db->prepare($sql);
   		$statement->execute($data); 
	}
}

?>